package pers.xiaojun.boot.module.infra.dao.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import pers.xiaojun.boot.module.infra.dao.entity.ConfigDO;

/**
 * 参数配置数据访问层
 *
 * @author xiaojun
 * @since 2025-11-09
 */
@Mapper
public interface ConfigMapper extends BaseMapper<ConfigDO> {

    /**
     * 根据参数键值获取参数
     *
     * @param configKey 参数键值
     * @return 参数
     */
    default ConfigDO selectByKey(String configKey) {
        return selectOne(new LambdaQueryWrapper<ConfigDO>()
                .eq(ConfigDO::getConfigKey, configKey)
        );
    }

}
